<?php

/**
 * test actions.
 *
 * @package    s-test
 * @subpackage test
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class testActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {
    
  }
  public function executeNewEmailTest(sfWebRequest $request){
    $this->form = new sfTestEmailForm();
  }
  public function executeSendEmailTest(sfWebRequest $request){
      $this->form = new sfTestEmailForm();
      $this->processForm($request, $this->form);

      $this->setTemplate("NewEmailTest");
  }
  protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
    if ($form->isValid())
    {
      $to = $form->getValue("to");
      $body = $form->getValue("body", ESC_RAW);
      $title = $form->getValue("title");
      sfEmailManager::getSingleton()->createEmail($to, $title, $body, "text/html")->send();

      $this->redirect("test/index");
    }
  }
}
